/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						script_hero_adjustment_action.h

	$Header: /heroes4/script_hero_adjustment_action.h $

	$NoKeywords: $

 ************************************************************************/


#ifndef _HDR_SCRIPT_HERO_ADJUSTMENT_ACTION
#define _HDR_SCRIPT_HERO_ADJUSTMENT_ACTION

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "script_simple_adjustment_action.h"
#include "streambuf_operators.h"
#include "script_targeting.h"
#include "hero.h"

class t_adventure_map;

template < typename t_adjustment_io >
class t_script_hero_adjustment_action : 
	public t_script_simple_adjustment_action< t_script_hero_target, t_adjustment_io >
{
public:
	virtual void	execute(t_script_context_hero const& context) const;
	virtual void	execute(t_script_context_town const& context) const;
	virtual void	execute(t_script_context_object const& context) const;
	virtual void	execute(t_script_context_army const& context) const;
	virtual void	execute(t_script_context_global const& context) const;

protected:
	virtual void	make_adjustment(t_adventure_map* map, t_hero* hero) const = 0;
};

template < typename t_adjustment_io >
void t_script_hero_adjustment_action< t_adjustment_io >::execute(t_script_context_hero const& context) const
{
	t_hero* target_hero = select_hero_by_target(get_target(), NULL, context.hero, context.army, context.opposing_army );

	make_adjustment(context.map, target_hero);
}

template < typename t_adjustment_io >
void t_script_hero_adjustment_action< t_adjustment_io >::execute(t_script_context_town const& context) const
{
	t_hero* target_hero = select_hero_by_target(get_target(), context.garrison, NULL, context.opposing_army, context.opposing_army );

	make_adjustment(context.map, target_hero);
}

template < typename t_adjustment_io >
void t_script_hero_adjustment_action< t_adjustment_io >::execute(t_script_context_object const& context) const
{
	assert(false);
}

template < typename t_adjustment_io >
void t_script_hero_adjustment_action< t_adjustment_io >::execute(t_script_context_army const& context) const
{
	t_hero* target_hero = select_hero_by_target(get_target(), NULL, NULL, context.army, context.opposing_army );

	make_adjustment(context.map, target_hero);
}

template < typename t_adjustment_io >
void t_script_hero_adjustment_action< t_adjustment_io >::execute(t_script_context_global const& context) const
{
	assert(false);
}

#endif 
